<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.jsp.bean.VehicleBean" %>
<%@ page import="com.jsp.dao.VehicleDao" %>
<%@ page import="com.jsp.util.DBUtil" %>
<%@ page import="java.sql.*" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'vehicle.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  <style> 
  td  
   {  
    text-align:center;  
   }  
  </style>

  </head>
  
  <body background="images/picture_4.png">
  <div class="officialcar">
      <center><h1>欢迎进入管理员系统</h1>
      <p>车辆信息</p><br/>
     <table border="1" cellpadding="2" cellspacing="0">  
        <tr>
            <td><b>车辆号</b></td>  
            <td><b>车牌号</b></td>           
            <td><b>车型</b></td>
            <td><b>出厂日期</b></td>
            <td><b>司机信息</b></td>
            <td><b>状态</b></td> 
            <td><b></b></td>              
        </tr>
        
         <%
        int startPage = 0;
        int diePage = 100;  
        List <VehicleBean> list = new ArrayList <VehicleBean>();
        Connection con = DBUtil.getConnection();
        String sql = "select * from Vehicleinformation order by id asc limit ?,?";
        PreparedStatement state = con.prepareStatement(sql);
		state.setInt(1,startPage);
		state.setInt(2,diePage);
        ResultSet rs = state.executeQuery(); 
        while(rs.next()){
        %>
         <tr>  
              <td id="td"><%=rs.getString("id") %></td>
              <td id="td"><%=rs.getString("plateNumber") %></td>
              <td id="td"><%=rs.getString("models")%></td>
              <td id="td"><%=rs.getString("productDate")%></td>
              <td id="td"><%=rs.getString("driverInformation")%></td>
              <td id="td"><%=rs.getString("state")%></td>                                      
           <td> 
              <form action="VehicleInformationServlet?mark=delete" method="post">
              <input type="hidden" name="id" value=<%=rs.getString("id") %>>
              <input type="submit" name="delete" value="删除">
              </form>
          </td>                                                                       
       </tr>            
         <%}
           state.close();
           con.close();
          %>
   </table>
      <br>    
      <div>
          <center><a href="admin/updatevehicle.jsp"><input name="commit1" type="submit" id="update" value="更新"></a>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;       
          <a href="admin/insertvehicle.jsp"><input name="commit2" type="submit" id="insert" value="增加"></a>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          <a href="adminmain.jsp"><input name="commit3" type="submit" id="back" value="返回"></a>
     </div>    
   </div>    
  </body>
</html>
